//
//  EveryDayModel.m
//  xiaorizi
//
//  Created by kun on 15/10/24.
//  Copyright © 2015年 origin. All rights reserved.
//

#import "EveryDayModel.h"


#import "MJExtension.h"

@implementation EveryDayModel

MJCodingImplementation

+(EveryDayModel *)initWithDic:(NSDictionary *)dic
{
    return [[self alloc]initWithDic:dic];
}
-(EveryDayModel *)initWithDic:(NSDictionary *)dic
{
    CGFloat themesH = 200;
    CGFloat eventsH =200;
    
    if(self =  [super init])
    {
        
        self.date = dic[@"date"];
        
        if(dic[@"events"] != nil)
        {
            eventsH = 0;
            
            NSArray *dataArray = dic[@"events"];
            NSDictionary *dataDic = dataArray[0];
    
            self.feeltitle = dataDic[@"feeltitle"];
            self.imgs = [dataDic[@"imgs"] lastObject];
            self.title = dataDic[@"title"];
            self.address = dataDic[@"address"];
            self.mobileURL = dataDic[@"mobileURL"];
            self.shareURL = dataDic[@"shareURL"];
            self.telephone = dataDic[@"telephone"];
            
            self.remark = dataDic[@"remark"];
            self.telephone = dataDic[@"telephone"];
            self.position = dataDic[@"position"];
            self.tag = dataDic[@"tag"];
        }
        //是有存在主题页
       // NSLog(@"---->dic : %@",[dic[@"themes"] lastObject]);
        if([dic[@"themes"] lastObject])
        {
            themesH = 0;
            NSArray *dataArray = dic[@"themes"];
            NSDictionary *dataDic = [dataArray lastObject];
            self.themes = [DvdModel initWithDic:dataDic];
        }
        
        self.cellHeight = 447 - themesH - eventsH;
    }
    
    return self;
}




@end
